; 
; This is a script that, when loaded before an 'actor' object will cause
; the data to marshall itself into a 'key=value;key=value;foo=bar;' formatted
; string which can easily be chooped up for use by any code in any language.
; The chief advantage here is that data types can be verified at run time, by
; run time criteria specified here if need be.
;
(load "flatten.scm")
(define actor
 (lambda ($type $m $ws $bs $s $t $ar $w $i $a)
  (string-append $type $m $ws $bs $s $t $ar $w $i $a)))
(define type
 (lambda (x)
  (flatten "type" x)))
(define move
 (lambda (x)
  (flatten-number "move" x)))
(define weapon-skill
 (lambda (x)
  (flatten-number "weapon-skill" x)))
(define ballistic-skill
 (lambda (x)
  (flatten-number "ballistic-skill" x)))
(define strength
 (lambda (x)
  (flatten-number "strength" x)))
(define toughness
 (lambda (x)
  (flatten-number "toughness" x)))
(define armour
 (lambda ($x)
  (flatten-number "armour" $x)))
(define wounds
 (lambda ($max $left)
  (if (<= $left $max)
   (string-append (flatten-number "wounds-max" $max) (flatten-number "wounds-left" $left))
   "!ERROR: Actor cannot have more wounds left than its maximum wounds count.")))
(define wounds-max
 (lambda ($x)
  (flatten-number "wounds-max" $x)))
;  (flatten-number "wounds" x)))
;
; (lambda ($max #!optional!# $left)
;  (if (default-object? $left)
;   (flatten-number "wounds-max" $max)
;   (if (< $left $max)
;    (string-append (flatten-number "wounds-max" $max) (flatten-number "wounds-left" $left)) "!ERROR?"))))
(define initiative
 (lambda (x)
  (flatten-number "initiative" x)))
(define attacks
 (lambda (x)
  (flatten-number "attacks" x)))
